<template>
  <!--审核-->
  <div>
    <list :vipRecord="vipRecord"></list>
    <div class="beizhu" v-if="vipRecord.remark!=''">
      <p>销售备注</p>
      <div>{{vipRecord.remark}}</div>
    </div>
    <div class="beizhu" v-if="vipRecord.checkRemark!=''">
      <p>审核备注</p>
      <div>{{vipRecord.checkRemark}}</div>
    </div>
    <p class="bottom"><span @click="isvisible=true">通过</span><span @click="islook=true">不通过</span></p>
    <div class="model" v-show="isvisible||islook">
      <div class="bg"></div>
      <div class="modelContent">
        <img src="../../../assets/close.png" alt="" width="15" @click="isvisible=false,islook=false">
        <ul>
          <li>审核</li>
          <li v-if="islook==true">
            <p class="title">不通过原因</p>
            <wv-group>
              <wv-textarea placeholder="请输入不通过原因"  v-model="content" :show-counter="false"></wv-textarea>
            </wv-group>
          </li>
        </ul>
        <p class="btn">
          <button @click="isvisible=false,islook=false">取消</button>
          <button>
            <span v-show="isvisible" @click="goPass(vipRecord)">通过</span>
            <span v-show="islook" @click="goNoPass(vipRecord)">不通过</span>
          </button>
        </p>
      </div>
    </div>
  </div>
</template>

<script type="text/ecmascript-6">
  import list from '../../template/addhuiyuan'
  import {employeeViprecordDetail, employeeManagerCheck} from '../../../../test/unit/http'
  import Toast from 'we-vue';
  export default {
    name: '',
    props: {},
    data() {
      return {
        isvisible: false,
        islook: false,
        vipRecord: {},
        content:''
      };
    },
    methods: {
      goSubemployeeManagerCheck(params){
        employeeManagerCheck(params).then(res => {
          console.log(res);
          if (res.code == 100) {
            this.$router.push({path: 'jinglihuiyuan'})
          }else{
            Toast.text(res.info)
          }
        })
      },
      goPass(vipRecord){
        let params = {vipRecordId:vipRecord.vipRecordId,accountGoodsId:vipRecord.accountGoodsId,isCheck:2};
        this.goSubemployeeManagerCheck(params);
      },
      goNoPass(vipRecord){
        let params = {vipRecordId:vipRecord.vipRecordId,accountGoodsId:vipRecord.accountGoodsId,isCheck:3,checkRemark:this.content};
        this.goSubemployeeManagerCheck(params);
      }
    },
    created() {
      var vipRecordId = this.$route.query.vipRecordId;
      employeeViprecordDetail({vipRecordId: vipRecordId}).then(res => {
        console.log(res);
        if (res.code == 100) {
          this.vipRecord = res.object;
        }
      })
    },
    components: {
      list
    }
  }
</script>


<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped lang="less" rel="stylesheet/less">
  .bg{
    background-color: rgba(0,0,0,0.3);
    width: 100%;
    height: 100%;
    position: fixed;
    top:0;
    left: 0;
    bottom: 50px;
  }
  .model .modelContent{
    background-color: #fff;
    border-radius: 8px;
    position: fixed;
    left: 50%;
    top:50%;
    margin-left: -43%;
    margin-top:-111px;
    z-index: 2;
    padding: 5px 10px 20px;
    width: 80%;
    li:first-child{
      margin-bottom: 10px;
    }
    img{
      position: absolute;
      right: 10px;
      top:10px
    }
    .btn{
      button{
        height: 42px;
        line-height: 42px;
        color: #fff;
        outline: none;
        border:none;
        width: calc(50% - 20px);
        border-radius: 8px;
        margin-top: 25px;
      }
      button:last-child{
        background-color: #fff;
        border:1px solid #f98e3c;
        color: #f98e3c;
      }
      button:first-child{
        background-color: #f98e3c;
        margin-right: 20px;

      }
    }
    .title{
      color: #F88D3B;
      font-size: 13px;
      text-align: left;
      padding-left: 14px;
    }
  }
  .beizhu{
    margin:0 15px;
    padding: 10px 0 60px;
    color: #999;
    text-align: left;
    p{
      color: #2c3e50;
      margin-bottom: 10px;
    }
  }
  .bottom{
    z-index: 999;
    position: fixed;
    bottom: 0;
    height: 50px;
    line-height: 50px;
    display: flex;
    width: 100%;
    font-size: 17px;
    background-color: #fff;
    span{
      flex: 1;
      width: 50%;
      display: inline-block;
    }
    :first-child{
      color: #fff;
      background-color: #f98e3c;
    }
    :last-child{
      color: #fb556a;
    }

  }
</style>
